// Latent Gold syntax - HMM analysis //

//LG4.5//
version = 4.5
infile 'H:\data\dep_interview\dep_interview_data_lfs_allcoh2.csv' quote = single


model
title Model2;
options
   algorithm 
      tolerance=1e-008 emtolerance=0.01 emiterations=2500 nriterations=50;
   startvalues
      seed=0 sets=20 tolerance=1e-005 iterations=50;
   bayes 
      categorical=1 variances=1 latent=1 poisson=1;
   missing  includeall;
   output 
              parameters=first profile estimatedvalues iterationdetails standarderrors
writeparameters='H:\data\dep_interview\output_dep_interview.txt' ;     
 outfile  'H:\data\dep_interview\data_analysis_dep_interview.sav' classification prediction;

variables
   caseid ID;
   dependent CONTRACTSOORT_num nominal, CONTRACTLFS_num nominal;
   independent CONTRACTLFS_LAG_num nominal, CONTRACTSOORT_LAG_num nominal, month numeric, gender nominal, education nominal, nationality nominal, DI nominal;
  latent
      Class time nominal 3, Classlag time nominal 3; 
equations
   Class[=0] <- (g) 1 | gender + (f1) education + (f2) nationality;
   Classlag[=0] <- (g) 1;
   Classlag <- (blag~tra) 1 | Class[-1] ;
   Class<- (~tra) 1 | Class[-1] + (c~tra) month | Class[-1] + (c2~tra) month month | Class[-1]  + (a3~tra) gender | Class[-1] + (a4~tra) education | Class[-1]  + (a5~tra) nationality | Class[-1] ;
   CONTRACTLFS_num <- (a1~err) 1 | Class +(a2~err) DI | Class + (b1~err) 1 | Class CONTRACTLFS_LAG_num Classlag + (b2~err) DI | Class CONTRACTLFS_LAG_num Classlag;
   CONTRACTSOORT_num  <- (b~err) 1 | Class + (c1~err) 1 | CONTRACTSOORT_LAG_num Class Classlag;
   blag = -100; 

b ~= -15; a1~=-8; a2~=6; c1~=5;

a2[1,2]=0;
a2[1,4]=0;

a2[3,1]=0;
a2[3,3]=0;



b1[1,1]=0;     
b1[1,2]=0;    
b1[2,1]=0;     
b1[2,2]=0;    
b1[3,1]=0;     
b1[3,2]=0;    
b1[4,1]=0;        
b1[4,2]=0; 
b1[5,1]=0; 
b1[5,2]=0;    
b1[6,1]=0;        
b1[6,2]=0;    
b1[7,1]=0;     
b1[7,2]=0;     
b1[8,1]=0;     
b1[8,2]=0;
b1[9,1]=0;    
b1[9,2]=0;     
b1[10,2]=0;      
b1[11,2]=0; 
b1[12,1]=0;     
b1[12,2]=0;   
b1[13,1]=0;      
b1[13,2]=0;   
b1[14,1]=0;      
b1[14,2]=0;   
b1[15,1]=0;      
b1[15,2]=0;   
b1[16,1]=0;  
b1[16,2]=0;   
b1[17,1]=0;     
b1[18,1]=0;       
b1[19,1]=0;
b1[19,2]=0;   
b1[20,1]=0;   
b1[20,2]=0;   
b1[21,1]=0;   
b1[21,2]=0;   
b1[22,1]=0;      
b1[22,2]=0;   
b1[23,1]=0;
b1[23,2]=0;    
b1[24,1]=0;      
b1[24,2]=0;   
b1[25,1]=0;   
b1[25,2]=0;   
b1[26,1]=0;   
b1[26,2]=0;   
b1[27,1]=0;   
b1[27,2]=0;







b2[1,1]=0;
b2[1,2]=0;
b2[1,3]=0;
b2[1,4]=0;




b2[2,1]=0;
b2[2,2]=0;
b2[2,3]=0;
b2[2,4]=0;




b2[3,1]=0;
b2[3,2]=0;
b2[3,3]=0;
b2[3,4]=0;




b2[4,1]=0;
b2[4,2]=0;
b2[4,3]=0;
b2[4,4]=0;



b2[5,1]=0;
b2[5,2]=0;
b2[5,3]=0;
b2[5,4]=0;



b2[6,1]=0;
b2[6,2]=0;
b2[6,3]=0;
b2[6,4]=0;



b2[7,1]=0;
b2[7,2]=0;
b2[7,3]=0;
b2[7,4]=0;




b2[8,1]=0;
b2[8,2]=0;
b2[8,3]=0;
b2[8,4]=0;




b2[9,1]=0;
b2[9,2]=0;
b2[9,3]=0;
b2[9,4]=0;






b2[10,2]=0;
b2[10,4]=0;





b2[11,2]=0;
b2[11,4]=0;




b2[12,1]=0;
b2[12,2]=0;
b2[12,3]=0;
b2[12,4]=0;



b2[13,1]=0;
b2[13,2]=0;
b2[13,3]=0;
b2[13,4]=0;



b2[14,1]=0;
b2[14,2]=0;
b2[14,3]=0;
b2[14,4]=0;



b2[15,1]=0;
b2[15,2]=0;
b2[15,3]=0;
b2[15,4]=0;



b2[16,1]=0;
b2[16,2]=0;
b2[16,3]=0;
b2[16,4]=0;




b2[17,1]=0;
b2[17,3]=0;





b2[18,1]=0;
b2[18,3]=0;






b2[19,1]=0;
b2[19,2]=0;
b2[19,3]=0;
b2[19,4]=0;




b2[20,1]=0;
b2[20,2]=0;
b2[20,3]=0;
b2[20,4]=0;




b2[21,1]=0;
b2[21,2]=0;
b2[21,3]=0;
b2[21,4]=0;



b2[22,1]=0;
b2[22,2]=0;
b2[22,3]=0;
b2[22,4]=0;



b2[23,1]=0;
b2[23,2]=0;
b2[23,3]=0;
b2[23,4]=0;



b2[24,1]=0;
b2[24,2]=0;
b2[24,3]=0;
b2[24,4]=0;



b2[25,1]=0;
b2[25,2]=0;
b2[25,3]=0;
b2[25,4]=0;




b2[26,1]=0;
b2[26,2]=0;
b2[26,3]=0;
b2[26,4]=0;




b2[27,1]=0;
b2[27,2]=0;
b2[27,3]=0;
b2[27,4]=0;




c1[1,1]=0;     
c1[1,2]=0;    
c1[2,1]=0;     
c1[2,2]=0;    
c1[3,1]=0;     
c1[3,2]=0;    
c1[4,1]=0;        
c1[4,2]=0;    
c1[5,2]=0;    
c1[6,1]=0;        
c1[6,2]=0;    
c1[7,1]=0;     
c1[7,2]=0;     
c1[8,1]=0;     
c1[8,2]=0;     
c1[9,2]=0;     
c1[10,2]=0;   
c1[11,1]=0;   
c1[11,2]=0;   
c1[12,1]=0;   
c1[12,2]=0;   
c1[13,1]=0;      
c1[13,2]=0;   
c1[14,1]=0;      
c1[14,2]=0;   
c1[15,1]=0;      
c1[15,2]=0;   
c1[16,1]=0;   
c1[16,2]=0;   
c1[17,1]=0;   
c1[17,2]=0;   
c1[18,1]=0;      
c1[19,1]=0;   
c1[20,1]=0;   
c1[20,2]=0;   
c1[21,1]=0;   
c1[21,2]=0;   
c1[22,1]=0;      
c1[22,2]=0;   
c1[23,1]=0;      
c1[24,1]=0;      
c1[24,2]=0;   
c1[25,1]=0;   
c1[25,2]=0;   
c1[26,1]=0;   
c1[26,2]=0;   
c1[27,1]=0;   
c1[27,2]=0;
end model
